<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- action: 接口的地址
    method: 提交的方式 get，post.. -->
    <form>
        <input type="text" id="email_or_mobile" name="email_or_mobile"/>
        <input type="password" id="password" name="password" />
        <input type="checkbox" name="remember_me" checked />
        <button id="submit" type="submit">登录-submit</button>
        
    </form>
    <script src="./axios.js"></script>
    <script>
        document.querySelector('#submit').addEventListener('click', (e) => {
            // 阻止按钮的默认行为
            e.preventDefault()
            // alert(1)
            const username = document.querySelector('#email_or_mobile').value
            const password = document.querySelector('#password').value
            
            axios({
                url: 'http://ajax-api.itheima.net/api/data',
                method: 'POST',
                data: {
                    username: '小花',
                    password: '123456'
                }
            }).then(res => {
                console.log(res)
            })
        })
    </script>
</body>
</html>